package com.maserb.monitor.entity.card;

import com.maserb.monitor.entity.BaseIdEntity;
import com.maserb.monitor.entity.schoolStudent.SchoolStudentEntity;

import javax.persistence.*;

/**
 * 天波考勤记录
 */
@Entity
@Table(name = "attendance_record")
public class AttendanceRecordEntity extends BaseIdEntity {

    /**
     * 设备id
     */
    private String deviceId;

    /**
     * 卡号
     */
    private String cardId;

    /**
     * 学生id
     */
    private String studentId;

    /**
     * 签到时间
     */
    private String startTime;

    /**
     * 类型 0：进校 1：离校
     */
    private Integer optType;

    private String optTypeCn;

    private SchoolStudentEntity student;

    @Column(name = "device_id", length = 18)
    public String getDeviceId() {
        return deviceId;
    }

    public void setDeviceId(String deviceId) {
        this.deviceId = deviceId;
    }

    @Column(name = "card_id", length = 18)
    public String getCardId() {
        return cardId;
    }

    public void setCardId(String cardId) {
        this.cardId = cardId;
    }

    @Transient
    public String getStudentId() {
        return studentId;
    }

    public void setStudentId(String studentId) {
        this.studentId = studentId;
    }

    @Column(name = "start_time", length = 20)
    public String getStartTime() {
        return startTime;
    }

    public void setStartTime(String startTime) {
        this.startTime = startTime;
    }

    @Column(name = "opt_type")
    public Integer getOptType() {
        return optType;
    }

    public void setOptType(Integer optType) {
        this.optType = optType;
    }

    @Transient
    public String getOptTypeCn() {
        return optTypeCn;
    }

    public void setOptTypeCn(String optTypeCn) {
        this.optTypeCn = optTypeCn;
    }

    @ManyToOne(fetch = FetchType.EAGER)
    @JoinColumn(name = "student_id")
    public SchoolStudentEntity getStudent() {
        return student;
    }

    public void setStudent(SchoolStudentEntity student) {
        this.student = student;
    }
}
